package com.easyhuan.pojo;

public class PageInfo {
	private int currentPage;
	private int showNumber;
	private Long totalNumber;

	
	public int getCurrentPage() {
		return currentPage;
	}

	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}

	public int getShowNumber() {
		return showNumber;
	}

	public void setShowNumber(int showNumber) {
		this.showNumber = showNumber;
	}

	public Long getTotalNumber() {
		return totalNumber;
	}

	public void setTotalNumber(Long long1) {
		this.totalNumber = long1;
	}

	public PageInfo(int currentPage, int showNumber, int totalNumber) {
		super();
		this.currentPage = currentPage;
		this.showNumber = showNumber;
		this.totalNumber = (long) totalNumber;
	}

	public PageInfo(int showNumber, int totalNumber) {
		super();
		this.currentPage = 1;
		this.showNumber = showNumber;
		this.totalNumber = (long) totalNumber;
	}

	public PageInfo() {
		super();
		this.currentPage = 1;
	}

	public int getTotalPageNumber() {
		return (int) ((this.totalNumber - 1) / this.showNumber + 1);
	}

	public int getStart() {
		return (this.currentPage - 1) * this.showNumber;
	}

	public int getPrePage() {
		int temp = 1;
		if ((currentPage - 1) > 1) {
			temp = currentPage - 1;
		}

		return temp;
	}

	public int getNextPage() {
		int temp = currentPage + 1;
		if (temp > this.getTotalPageNumber()) {
			temp = this.getTotalPageNumber();
		}
		return temp;
	}
}
